from django.shortcuts import render_to_response

def base(request):
    return render_to_response("base.html")

def index(request):
    """首页"""
    return render_to_response("index.html")

def store(request):
    """订单管理"""
    return render_to_response("store.html")

def goods(request):
    """商品添加"""
    goods_list = [
        {"good_id":"00001","goods_name":"西红柿","goods_type":"蔬菜","goods_price":8.5,"goods_num":100},
        {"good_id":"00002","goods_name":"黄瓜","goods_type":"蔬菜","goods_price":8.2,"goods_num":100},
        {"good_id":"00003","goods_name":"茄子","goods_type":"蔬菜","goods_price":8.4,"goods_num":100},
        {"good_id":"00004","goods_name":"冬瓜","goods_type":"蔬菜","goods_price":8.9,"goods_num":100},
        {"good_id":"00005","goods_name":"南瓜","goods_type":"蔬菜","goods_price":8.7,"goods_num":100},
    ]
    return render_to_response("goods.html",locals())

def orders(request):
    """订单确认"""
    orders_list = [
        {"orders_id":"00001","orders_goods":"西红柿","orders_time":"2020-12-12","orders_price":8.1,"orders_num":10,"orders_money":81},
        {"orders_id":"00002","orders_goods":"黄瓜","orders_time":"2020-12-23","orders_price":8.5,"orders_num":10,"orders_money":85},
        {"orders_id":"00003","orders_goods":"冬瓜","orders_time":"2020-12-08","orders_price":8.8,"orders_num":10,"orders_money":88},
        {"orders_id":"00004","orders_goods":"芹菜","orders_time":"2020-12-19","orders_price":8.6,"orders_num":10,"orders_money":86},
        {"orders_id":"00005","orders_goods":"豆角","orders_time":"2020-12-02","orders_price":8.4,"orders_num":10,"orders_money":84},
    ]
    return render_to_response("orders.html",locals())

def statistics_goods(request):
    """商品统计"""
    return render_to_response("statistics_goods.html")

def statistics_orders(request):
    """订单统计"""
    return render_to_response("statistics_orders.html")

import time
def birthday(request,month,day):
    """生日统计"""
    year = time.localtime().tm_year   # 获取当前的年份
    string_time = "{}-{}-{}".format(year,month,day)  # 转化为字符串格式时间
    now = time.strptime(string_time,"%Y-%m-%d")  #将字符串格式的时间转化为九元素时间
    result = now.tm_yday  # 获取是一年的第几天
    return render_to_response("birthday.html",locals())